package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dtos.SensitiveDTO;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/v1/sensitive")
public class AdSensitiveController {
    @Autowired
    AdSensitiveService adSensitiveService;


    @PostMapping("list")
    public ResponseResult getSensitiveList(@RequestBody SensitiveDTO dto){

        return adSensitiveService.getSensitiveList(dto);
    }

    @PostMapping("save")
    public ResponseResult insertSensitive(@RequestBody AdSensitive adSensitive){
        return adSensitiveService.insertSensitive(adSensitive);
    }
    @PostMapping("update")
    public ResponseResult updateSensitive(@RequestBody AdSensitive adSensitive){
        return adSensitiveService.updateSensitive(adSensitive);
    }
    @DeleteMapping("del/{id}")
    public ResponseResult deleteSensitive(@PathVariable("id")Integer id){
        return adSensitiveService.deleteSensitive(id);
    }
    @PostMapping("sensitives")
    public ResponseResult findAllSensitive(){
        return adSensitiveService.selectAllSensitive();
    }


}
